#coding:utf8
from django.conf.urls import url

from users.views import *
from . import views

from rest_framework_jwt.views import obtain_jwt_token

from rest_framework.routers import DefaultRouter
router = DefaultRouter()
router.register(r'addresses',AddressViewSet,base_name='address')

urlpatterns = [
    #/users/usernames/(?P<username>\w{5,20})/count/
    url(r'^usernames/(?P<username>\w{5,20})/count/$',views.RegisterUserNameView.as_view(),name='usernamecount'),
    url(r'^$',views.RegisterCreateUserView.as_view()),
    # 定义登录的url
    # users/auths/
    #ObtainJSONWebToken.as_view()
    # obtain_jwt_token 这个视图可以实现对用户名和密码的校验
    # 合并购物车修改登录ｕｒｌ
    # url(r'^auths/$',obtain_jwt_token),
    url(r'^auths/$',views.UserAuthorizationView.as_view(), name='auths'),
    # GET /users/infos/
    url(r'^infos/$',views.UserDetailView.as_view(), name='detail'),
    url(r'^emails/$',views.EmailView.as_view(), name='send_mail'),
    # ＧＥＴ邮箱验证
    url(r'^emails/verification/$', views.VerificationEmailView.as_view()),
    # /users/browerhistories/,浏览历史记录
    url(r'^browerhistories/$', views.UserBrowsingHistoryView.as_view(), name='history'),
]

urlpatterns += router.urls